<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>elasticsearch-node | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'node-tool.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/node-tool.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/node-tool.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/node-tool.html" rel="nofollow" target="_blank">../en/node-tool.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="commands.html">Command line tools</a></span>
»
<span class="breadcrumb-node">elasticsearch-node</span>
</div>
<div class="navheader">
<span class="prev">
<a href="migrate-tool.html">« elasticsearch-migrate</a>
</span>
<span class="next">
<a href="saml-metadata.html">elasticsearch-saml-metadata »</a>
</span>
</div>
<div class="chapter">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="node-tool"></a>elasticsearch-node<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h2>
</div></div></div>
<p>The <code class="literal">elasticsearch-node</code> command enables you to perform certain unsafe
operations on a node that are only possible while it is shut down. This command
allows you to adjust the <a class="xref" href="modules-node.html" title="Node">role</a> of a node, unsafely edit cluster
settings and may be able to recover some data after a disaster or start a node
even if it is incompatible with the data on disk.</p>
<h3>
<a id="_synopsis_5"></a>Synopsis<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h3>
<div class="pre_wrapper lang-shell">
<pre class="programlisting prettyprint lang-shell">bin/elasticsearch-node repurpose|unsafe-bootstrap|detach-cluster|override-version
  [--ordinal &lt;Integer&gt;] [-E &lt;KeyValuePair&gt;]
  [-h, --help] ([-s, --silent] | [-v, --verbose])</pre>
</div>
<h3>
<a id="_description_5"></a>Description<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h3>
<p>This tool has a number of modes:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<code class="literal">elasticsearch-node repurpose</code> can be used to delete unwanted data from a
node if it used to be a <a class="xref" href="modules-node.html#data-node" title="Data node">data node</a> or a
<a class="xref" href="modules-node.html#master-node" title="Master-eligible node">master-eligible node</a> but has been repurposed not to have one
or other of these roles.
</li>
<li class="listitem">
<code class="literal">elasticsearch-node remove-settings</code> can be used to remove persistent settings
from the cluster state in case where it contains incompatible settings that
prevent the cluster from forming.
</li>
<li class="listitem">
<code class="literal">elasticsearch-node remove-customs</code> can be used to remove custom metadata
from the cluster state in case where it contains broken metadata that
prevents the cluster state from being loaded.
</li>
<li class="listitem">
<code class="literal">elasticsearch-node unsafe-bootstrap</code> can be used to perform <em>unsafe cluster
bootstrapping</em>.  It forces one of the nodes to form a brand-new cluster on
its own, using its local copy of the cluster metadata.
</li>
<li class="listitem">
<code class="literal">elasticsearch-node detach-cluster</code> enables you to move nodes from one
cluster to another.  This can be used to move nodes into a new cluster
created with the <code class="literal">elasticsearch-node unsafe-bootstrap</code> command. If unsafe
cluster bootstrapping was not possible, it also enables you to move nodes
into a brand-new cluster.
</li>
<li class="listitem">
<code class="literal">elasticsearch-node override-version</code> enables you to start up a node
even if the data in the data path was written by an incompatible version of
Elasticsearch. This may sometimes allow you to downgrade to an earlier version of
Elasticsearch.
</li>
</ul>
</div>
<h4>
<a id="node-tool-repurpose"></a>Changing the role of a node<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>There may be situations where you want to repurpose a node without following
the <a class="xref" href="modules-node.html#change-node-role" title="Changing the role of a node">proper repurposing processes</a>. The <code class="literal">elasticsearch-node
repurpose</code> tool allows you to delete any excess on-disk data and start a node
after repurposing it.</p>
<p>The intended use is:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
Stop the node
</li>
<li class="listitem">
Update <code class="literal">elasticsearch.yml</code> by setting <code class="literal">node.master</code> and <code class="literal">node.data</code> as
desired.
</li>
<li class="listitem">
Run <code class="literal">elasticsearch-node repurpose</code> on the node
</li>
<li class="listitem">
Start the node
</li>
</ul>
</div>
<p>If you run <code class="literal">elasticsearch-node repurpose</code> on a node with <code class="literal">node.data: false</code> and
<code class="literal">node.master: true</code> then it will delete any remaining shard data on that node,
but it will leave the index and cluster metadata alone. If you run
<code class="literal">elasticsearch-node repurpose</code> on a node with <code class="literal">node.data: false</code> and
<code class="literal">node.master: false</code> then it will delete any remaining shard data and index
metadata, but it will leave the cluster metadata alone.</p>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>Running this command can lead to data loss for the indices mentioned if the
data contained is not available on other nodes in the cluster. Only run this
tool if you understand and accept the possible consequences, and only after
determining that the node cannot be repurposed cleanly.</p>
</div>
</div>
<p>The tool provides a summary of the data to be deleted and asks for confirmation
before making any changes. You can get detailed information about the affected
indices and shards by passing the verbose (<code class="literal">-v</code>) option.</p>
<h4>
<a id="_removing_persistent_cluster_settings"></a>Removing persistent cluster settings<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>There may be situations where a node contains persistent cluster
settings that prevent the cluster from forming. Since the cluster cannot form,
it is not possible to remove these settings using the
<a class="xref" href="cluster-update-settings.html" title="Cluster update settings API">Cluster update settings</a> API.</p>
<p>The <code class="literal">elasticsearch-node remove-settings</code> tool allows you to forcefully remove
those persistent settings from the on-disk cluster state. The tool takes a
list of settings as parameters that should be removed, and also supports
wildcard patterns.</p>
<p>The intended use is:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
Stop the node
</li>
<li class="listitem">
Run <code class="literal">elasticsearch-node remove-settings name-of-setting-to-remove</code> on the node
</li>
<li class="listitem">
Repeat for all other master-eligible nodes
</li>
<li class="listitem">
Start the nodes
</li>
</ul>
</div>
<h4>
<a id="_removing_custom_metadata_from_the_cluster_state"></a>Removing custom metadata from the cluster state<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>There may be situations where a node contains custom metadata, typically
provided by plugins, that prevent the node from starting up and loading
the cluster from disk.</p>
<p>The <code class="literal">elasticsearch-node remove-customs</code> tool allows you to forcefully remove
the problematic custom metadata. The tool takes a list of custom metadata names
as parameters that should be removed, and also supports wildcard patterns.</p>
<p>The intended use is:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
Stop the node
</li>
<li class="listitem">
Run <code class="literal">elasticsearch-node remove-customs name-of-custom-to-remove</code> on the node
</li>
<li class="listitem">
Repeat for all other master-eligible nodes
</li>
<li class="listitem">
Start the nodes
</li>
</ul>
</div>
<h4>
<a id="_recovering_data_after_a_disaster"></a>Recovering data after a disaster<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>Sometimes Elasticsearch nodes are temporarily stopped, perhaps because of the need to
perform some maintenance activity or perhaps because of a hardware failure.
After you resolve the temporary condition and restart the node,
it will rejoin the cluster and continue normally. Depending on your
configuration, your cluster may be able to remain completely available even
while one or more of its nodes are stopped.</p>
<p>Sometimes it might not be possible to restart a node after it has stopped. For
example, the node’s host may suffer from a hardware problem that cannot be
repaired. If the cluster is still available then you can start up a fresh node
on another host and Elasticsearch will bring this node into the cluster in place of the
failed node.</p>
<p>Each node stores its data in the data directories defined by the
<a class="xref" href="path-settings.html" title="path.data and path.logs"><code class="literal">path.data</code> setting</a>. This means that in a disaster you can
also restart a node by moving its data directories to another host, presuming
that those data directories can be recovered from the faulty host.</p>
<p>Elasticsearch <a class="xref" href="modules-discovery-quorums.html" title="Quorum-based decision making">requires a response from a majority of the
master-eligible nodes</a> in order to elect a master and to update the cluster
state. This means that if you have three master-eligible nodes then the cluster
will remain available even if one of them has failed. However if two of the
three master-eligible nodes fail then the cluster will be unavailable until at
least one of them is restarted.</p>
<p>In very rare circumstances it may not be possible to restart enough nodes to
restore the cluster’s availability. If such a disaster occurs, you should
build a new cluster from a recent snapshot and re-import any data that was
ingested since that snapshot was taken.</p>
<p>However, if the disaster is serious enough then it may not be possible to
recover from a recent snapshot either. Unfortunately in this case there is no
way forward that does not risk data loss, but it may be possible to use the
<code class="literal">elasticsearch-node</code> tool to construct a new cluster that contains some of the
data from the failed cluster.</p>
<h4>
<a id="node-tool-override-version"></a>Bypassing version checks<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>The data that Elasticsearch writes to disk is designed to be read by the current version
and a limited set of future versions. It cannot generally be read by older
versions, nor by versions that are more than one major version newer. The data
stored on disk includes the version of the node that wrote it, and Elasticsearch checks
that it is compatible with this version when starting up.</p>
<p>In rare circumstances it may be desirable to bypass this check and start up an
Elasticsearch node using data that was written by an incompatible version. This may not
work if the format of the stored data has changed, and it is a risky process
because it is possible for the format to change in ways that Elasticsearch may
misinterpret, silently leading to data loss.</p>
<p>To bypass this check, you can use the <code class="literal">elasticsearch-node override-version</code>
tool to overwrite the version number stored in the data path with the current
version, causing Elasticsearch to believe that it is compatible with the on-disk data.</p>
<h5>
<a id="node-tool-unsafe-bootstrap"></a>Unsafe cluster bootstrapping<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h5>
<p>If there is at least one remaining master-eligible node, but it is not possible
to restart a majority of them, then the <code class="literal">elasticsearch-node unsafe-bootstrap</code>
command will unsafely override the cluster’s <a class="xref" href="modules-discovery-voting.html" title="Voting configurations">voting
configuration</a> as if performing another
<a class="xref" href="modules-discovery-bootstrap-cluster.html" title="Bootstrapping a cluster">cluster bootstrapping process</a>.
The target node can then form a new cluster on its own by using
the cluster metadata held locally on the target node.</p>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>These steps can lead to arbitrary data loss since the target node may not hold the latest cluster
metadata, and this out-of-date metadata may make it impossible to use some or
all of the indices in the cluster.</p>
</div>
</div>
<p>Since unsafe bootstrapping forms a new cluster containing a single node, once
you have run it you must use the <a class="xref" href="node-tool.html#node-tool-detach-cluster" title="Detaching nodes from their cluster"><code class="literal">elasticsearch-node
detach-cluster</code> tool</a> to migrate any other surviving nodes from the failed
cluster into this new cluster.</p>
<p>When you run the <code class="literal">elasticsearch-node unsafe-bootstrap</code> tool it will analyse the
state of the node and ask for confirmation before taking any action. Before
asking for confirmation it reports the term and version of the cluster state on
the node on which it runs as follows:</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">Current node cluster state (term, version) pair is (4, 12)</pre>
</div>
<p>If you have a choice of nodes on which to run this tool then you should choose
one with a term that is as large as possible. If there is more than one
node with the same term, pick the one with the largest version.
This information identifies the node with the freshest cluster state, which minimizes the
quantity of data that might be lost. For example, if the first node reports
<code class="literal">(4, 12)</code> and a second node reports <code class="literal">(5, 3)</code>, then the second node is preferred
since its term is larger.  However if the second node reports <code class="literal">(3, 17)</code> then
the first node is preferred since its term is larger. If the second node
reports <code class="literal">(4, 10)</code> then it has the same term as the first node, but has a
smaller version, so the first node is preferred.</p>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>Running this command can lead to arbitrary data loss. Only run this tool if you
understand and accept the possible consequences and have exhausted all other
possibilities for recovery of your cluster.</p>
</div>
</div>
<p>The sequence of operations for using this tool are as follows:</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Make sure you have really lost access to at least half of the
master-eligible nodes in the cluster, and they cannot be repaired or recovered
by moving their data paths to healthy hardware.
</li>
<li class="listitem">
Stop <span class="strong strong"><strong>all</strong></span> remaining nodes.
</li>
<li class="listitem">
Choose one of the remaining master-eligible nodes to become the new elected
master as described above.
</li>
<li class="listitem">
On this node, run the <code class="literal">elasticsearch-node unsafe-bootstrap</code> command as shown
below. Verify that the tool reported <code class="literal">Master node was successfully
bootstrapped</code>.
</li>
<li class="listitem">
Start this node and verify that it is elected as the master node.
</li>
<li class="listitem">
Run the <a class="xref" href="node-tool.html#node-tool-detach-cluster" title="Detaching nodes from their cluster"><code class="literal">elasticsearch-node detach-cluster</code>
tool</a>, described below, on every other node in the cluster.
</li>
<li class="listitem">
Start all other nodes and verify that each one joins the cluster.
</li>
<li class="listitem">
Investigate the data in the cluster to discover if any was lost during this
process.
</li>
</ol>
</div>
<p>When you run the tool it will make sure that the node that is being used to
bootstrap the cluster is not running. It is important that all other
master-eligible nodes are also stopped while this tool is running, but the tool
does not check this.</p>
<p>The message <code class="literal">Master node was successfully bootstrapped</code> does not mean that
there has been no data loss, it just means that tool was able to complete its
job.</p>
<h5>
<a id="node-tool-detach-cluster"></a>Detaching nodes from their cluster<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h5>
<p>It is unsafe for nodes to move between clusters, because different clusters
have completely different cluster metadata. There is no way to safely merge the
metadata from two clusters together.</p>
<p>To protect against inadvertently joining the wrong cluster, each cluster
creates a unique identifier, known as the <em>cluster UUID</em>, when it first starts
up. Every node records the UUID of its cluster and refuses to join a
cluster with a different UUID.</p>
<p>However, if a node’s cluster has permanently failed then it may be desirable to
try and move it into a new cluster. The <code class="literal">elasticsearch-node detach-cluster</code>
command lets you detach a node from its cluster by resetting its cluster UUID.
It can then join another cluster with a different UUID.</p>
<p>For example, after unsafe cluster bootstrapping you will need to detach all the
other surviving nodes from their old cluster so they can join the new,
unsafely-bootstrapped cluster.</p>
<p>Unsafe cluster bootstrapping is only possible if there is at least one
surviving master-eligible node. If there are no remaining master-eligible nodes
then the cluster metadata is completely lost. However, the individual data
nodes also contain a copy of the index metadata corresponding with their
shards. This sometimes allows a new cluster to import these shards as
<a class="xref" href="modules-gateway-dangling-indices.html" title="Dangling indices">dangling indices</a>. You can sometimes
recover some indices after the loss of all master-eligible nodes in a cluster
by creating a new cluster and then using the <code class="literal">elasticsearch-node
detach-cluster</code> command to move any surviving nodes into this new cluster.</p>
<p>There is a risk of data loss when importing a dangling index because data nodes
may not have the most recent copy of the index metadata and do not have any
information about <a class="xref" href="docs-replication.html" title="Reading and Writing documents">which shard copies are in-sync</a>. This
means that a stale shard copy may be selected to be the primary, and some of
the shards may be incompatible with the imported mapping.</p>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>Execution of this command can lead to arbitrary data loss. Only run this tool
if you understand and accept the possible consequences and have exhausted all
other possibilities for recovery of your cluster.</p>
</div>
</div>
<p>The sequence of operations for using this tool are as follows:</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Make sure you have really lost access to every one of the master-eligible
nodes in the cluster, and they cannot be repaired or recovered by moving their
data paths to healthy hardware.
</li>
<li class="listitem">
Start a new cluster and verify that it is healthy. This cluster may comprise
one or more brand-new master-eligible nodes, or may be an unsafely-bootstrapped
cluster formed as described above.
</li>
<li class="listitem">
Stop <span class="strong strong"><strong>all</strong></span> remaining data nodes.
</li>
<li class="listitem">
On each data node, run the <code class="literal">elasticsearch-node detach-cluster</code> tool as shown
below. Verify that the tool reported <code class="literal">Node was successfully detached from the
cluster</code>.
</li>
<li class="listitem">
If necessary, configure each data node to
<a class="xref" href="modules-discovery-hosts-providers.html" title="Discovery">discover the new cluster</a>.
</li>
<li class="listitem">
Start each data node and verify that it has joined the new cluster.
</li>
<li class="listitem">
Wait for all recoveries to have completed, and investigate the data in the
cluster to discover if any was lost during this process.
</li>
</ol>
</div>
<p>The message <code class="literal">Node was successfully detached from the cluster</code> does not mean
that there has been no data loss, it just means that tool was able to complete
its job.</p>
<h3>
<a id="_parameters_9"></a>Parameters<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h3>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">repurpose</code>
</span>
</dt>
<dd>
Delete excess data when a node’s roles are changed.
</dd>
<dt>
<span class="term">
<code class="literal">unsafe-bootstrap</code>
</span>
</dt>
<dd>
Specifies to unsafely bootstrap this node as a new
one-node cluster.
</dd>
<dt>
<span class="term">
<code class="literal">detach-cluster</code>
</span>
</dt>
<dd>
Specifies to unsafely detach this node from its cluster so
it can join a different cluster.
</dd>
<dt>
<span class="term">
<code class="literal">override-version</code>
</span>
</dt>
<dd>
Overwrites the version number stored in the data path so
that a node can start despite being incompatible with the on-disk data.
</dd>
<dt>
<span class="term">
<code class="literal">remove-settings</code>
</span>
</dt>
<dd>
Forcefully removes the provided persistent cluster settings
from the on-disk cluster state.
</dd>
<dt>
<span class="term">
<code class="literal">--ordinal &lt;Integer&gt;</code>
</span>
</dt>
<dd>
If there is <a class="xref" href="modules-node.html#max-local-storage-nodes" title="node.max_local_storage_nodes">more than one
node sharing a data path</a> then this specifies which node to target. Defaults
to <code class="literal">0</code>, meaning to use the first node in the data path.
</dd>
<dt>
<span class="term">
<code class="literal">-E &lt;KeyValuePair&gt;</code>
</span>
</dt>
<dd>
Configures a setting.
</dd>
<dt>
<span class="term">
<code class="literal">-h, --help</code>
</span>
</dt>
<dd>
Returns all of the command parameters.
</dd>
<dt>
<span class="term">
<code class="literal">-s, --silent</code>
</span>
</dt>
<dd>
Shows minimal output.
</dd>
<dt>
<span class="term">
<code class="literal">-v, --verbose</code>
</span>
</dt>
<dd>
Shows verbose output.
</dd>
</dl>
</div>
<h3>
<a id="_examples_8"></a>Examples<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h3>
<h4>
<a id="_repurposing_a_node_as_a_dedicated_master_node_master_true_data_false"></a>Repurposing a node as a dedicated master node (master: true, data: false)<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>In this example, a former data node is repurposed as a dedicated master node.
First update the node’s settings to <code class="literal">node.master: true</code> and <code class="literal">node.data: false</code>
in its <code class="literal">elasticsearch.yml</code> config file. Then run the <code class="literal">elasticsearch-node
repurpose</code> command to find and remove excess shard data:</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">node$ ./bin/elasticsearch-node repurpose

    WARNING: Elasticsearch MUST be stopped before running this tool.

Found 2 shards in 2 indices to clean up
Use -v to see list of paths and indices affected
Node is being re-purposed as master and no-data. Clean-up of shard data will be performed.
Do you want to proceed?
Confirm [y/N] y
Node successfully repurposed to master and no-data.</pre>
</div>
<h4>
<a id="_repurposing_a_node_as_a_coordinating_only_node_master_false_data_false"></a>Repurposing a node as a coordinating-only node (master: false, data: false)<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>In this example, a node that previously held data is repurposed as a
coordinating-only node. First update the node’s settings to <code class="literal">node.master:
false</code> and <code class="literal">node.data: false</code> in its <code class="literal">elasticsearch.yml</code> config file. Then run
the <code class="literal">elasticsearch-node repurpose</code> command to find and remove excess shard data
and index metadata:</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">node$./bin/elasticsearch-node repurpose

    WARNING: Elasticsearch MUST be stopped before running this tool.

Found 2 indices (2 shards and 2 index meta data) to clean up
Use -v to see list of paths and indices affected
Node is being re-purposed as no-master and no-data. Clean-up of index data will be performed.
Do you want to proceed?
Confirm [y/N] y
Node successfully repurposed to no-master and no-data.</pre>
</div>
<h4>
<a id="_removing_persistent_cluster_settings_2"></a>Removing persistent cluster settings<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>If your nodes contain persistent cluster settings that prevent the cluster
from forming, i.e., can’t be removed using the <a class="xref" href="cluster-update-settings.html" title="Cluster update settings API">Cluster update settings</a> API,
you can run the following commands to remove one or more cluster settings.</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">node$ ./bin/elasticsearch-node remove-settings xpack.monitoring.exporters.my_exporter.host

    WARNING: Elasticsearch MUST be stopped before running this tool.

The following settings will be removed:
xpack.monitoring.exporters.my_exporter.host: "10.1.2.3"

You should only run this tool if you have incompatible settings in the
cluster state that prevent the cluster from forming.
This tool can cause data loss and its use should be your last resort.

Do you want to proceed?

Confirm [y/N] y

Settings were successfully removed from the cluster state</pre>
</div>
<p>You can also use wildcards to remove multiple settings, for example using</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">node$ ./bin/elasticsearch-node remove-settings xpack.monitoring.*</pre>
</div>
<h4>
<a id="_removing_custom_metadata_from_the_cluster_state_2"></a>Removing custom metadata from the cluster state<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>If the on-disk cluster state contains custom metadata that prevents the node
from starting up and loading the cluster state, you can run the following
commands to remove this custom metadata.</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">node$ ./bin/elasticsearch-node remove-customs snapshot_lifecycle

    WARNING: Elasticsearch MUST be stopped before running this tool.

The following customs will be removed:
snapshot_lifecycle

You should only run this tool if you have broken custom metadata in the
cluster state that prevents the cluster state from being loaded.
This tool can cause data loss and its use should be your last resort.

Do you want to proceed?

Confirm [y/N] y

Customs were successfully removed from the cluster state</pre>
</div>
<h4>
<a id="_unsafe_cluster_bootstrapping"></a>Unsafe cluster bootstrapping<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>Suppose your cluster had five master-eligible nodes and you have permanently
lost three of them, leaving two nodes remaining.</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
Run the tool on the first remaining node, but answer <code class="literal">n</code> at the confirmation
step.
</li>
</ul>
</div>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">node_1$ ./bin/elasticsearch-node unsafe-bootstrap

    WARNING: Elasticsearch MUST be stopped before running this tool.

Current node cluster state (term, version) pair is (4, 12)

You should only run this tool if you have permanently lost half or more
of the master-eligible nodes in this cluster, and you cannot restore the
cluster from a snapshot. This tool can cause arbitrary data loss and its
use should be your last resort. If you have multiple surviving master
eligible nodes, you should run this tool on the node with the highest
cluster state (term, version) pair.

Do you want to proceed?

Confirm [y/N] n</pre>
</div>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
Run the tool on the second remaining node, and again answer <code class="literal">n</code> at the
confirmation step.
</li>
</ul>
</div>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">node_2$ ./bin/elasticsearch-node unsafe-bootstrap

    WARNING: Elasticsearch MUST be stopped before running this tool.

Current node cluster state (term, version) pair is (5, 3)

You should only run this tool if you have permanently lost half or more
of the master-eligible nodes in this cluster, and you cannot restore the
cluster from a snapshot. This tool can cause arbitrary data loss and its
use should be your last resort. If you have multiple surviving master
eligible nodes, you should run this tool on the node with the highest
cluster state (term, version) pair.

Do you want to proceed?

Confirm [y/N] n</pre>
</div>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
Since the second node has a greater term it has a fresher cluster state, so
it is better to unsafely bootstrap the cluster using this node:
</li>
</ul>
</div>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">node_2$ ./bin/elasticsearch-node unsafe-bootstrap

    WARNING: Elasticsearch MUST be stopped before running this tool.

Current node cluster state (term, version) pair is (5, 3)

You should only run this tool if you have permanently lost half or more
of the master-eligible nodes in this cluster, and you cannot restore the
cluster from a snapshot. This tool can cause arbitrary data loss and its
use should be your last resort. If you have multiple surviving master
eligible nodes, you should run this tool on the node with the highest
cluster state (term, version) pair.

Do you want to proceed?

Confirm [y/N] y
Master node was successfully bootstrapped</pre>
</div>
<h4>
<a id="_detaching_nodes_from_their_cluster"></a>Detaching nodes from their cluster<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>After unsafely bootstrapping a new cluster, run the <code class="literal">elasticsearch-node
detach-cluster</code> command to detach all remaining nodes from the failed cluster
so they can join the new cluster:</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">node_3$ ./bin/elasticsearch-node detach-cluster

    WARNING: Elasticsearch MUST be stopped before running this tool.

You should only run this tool if you have permanently lost all of the
master-eligible nodes in this cluster and you cannot restore the cluster
from a snapshot, or you have already unsafely bootstrapped a new cluster
by running `elasticsearch-node unsafe-bootstrap` on a master-eligible
node that belonged to the same cluster as this node. This tool can cause
arbitrary data loss and its use should be your last resort.

Do you want to proceed?

Confirm [y/N] y
Node was successfully detached from the cluster</pre>
</div>
<h4>
<a id="_bypassing_version_checks"></a>Bypassing version checks<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/node-tool.asciidoc">edit</a>
</h4>
<p>Run the <code class="literal">elasticsearch-node override-version</code> command to overwrite the version
stored in the data path so that a node can start despite being incompatible
with the data stored in the data path:</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">node$ ./bin/elasticsearch-node override-version

    WARNING: Elasticsearch MUST be stopped before running this tool.

This data path was last written by Elasticsearch version [x.x.x] and may no
longer be compatible with Elasticsearch version [y.y.y]. This tool will bypass
this compatibility check, allowing a version [y.y.y] node to start on this data
path, but a version [y.y.y] node may not be able to read this data or may read
it incorrectly leading to data loss.

You should not use this tool. Instead, continue to use a version [x.x.x] node
on this data path. If necessary, you can use reindex-from-remote to copy the
data from here into an older cluster.

Do you want to proceed?

Confirm [y/N] y
Successfully overwrote this node's metadata to bypass its version compatibility checks.</pre>
</div>
</div>
<div class="navfooter">
<span class="prev">
<a href="migrate-tool.html">« elasticsearch-migrate</a>
</span>
<span class="next">
<a href="saml-metadata.html">elasticsearch-saml-metadata »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>